# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=dav1d
pkgver=1.0.0
pkgrel=0
pkgdesc="small and fast AV1 Decoder"
url="https://code.videolan.org/videolan/dav1d"
arch="all"
license="BSD-2-Clause"
makedepends="nasm meson"
subpackages="$pkgname-dev lib$pkgname:libs"
source="https://code.videolan.org/videolan/dav1d/-/archive/$pkgver/dav1d-$pkgver.tar.bz2
	fix-asmcheck.patch
	"

build() {
	case "$CARCH" in
		armhf*) meson_opts="-Denable_asm=false" ;;
		*) meson_opts="-Denable_asm=true" ;;
	esac

	abuild-meson \
		-Denable_tests=true \
		-Denable_tools=true \
		-Dfuzzing_engine=none \
		-Dtestdata_tests=false \
		$meson_opts \
		build
	meson compile ${JOBS:+-j ${JOBS}} -C build
}

check() {
	meson test --no-rebuild -v -C build
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C build
}

sha512sums="
86c6481e787fb6b8c28521e1efb1876d1be99f5fa5332cddab1111059b44775e05203cfc5c80a1b404ee00f35a1f5e1099e21b1f0851d77fb0101567e8b1a892  dav1d-1.0.0.tar.bz2
6635e139a601fd8455ea0979e6e070fa2635cbe1c185050f8d4145e8eb9e4aace066657411f4c92696b2528564a9f2c7fc751be47eaa4273f50cd11f4b4d3ccc  fix-asmcheck.patch
"
